C++的#include<>

来源:百度知道 编辑:UC知道 时间:2024/05/06 14:17:44
C++中的预处理#include<iostream>和#include<iostream.h>对程序的运行有什么不同?
#include<iostream>后加using namespace std;
和直接用#include<iostream.h>在运行上有什么区别?

没有区别
#include<iostream.h>是早些时候的形式
最新的标准定义的是
#include<iostream>
using namespace std;

比如#include<math.h>变成
#include<cmath>
using namespace std;

#include<string.h>变成
#include<cstring>
using namespace std;

但在实际执行的时候没有区别
VC两者都兼容
但最好用新标准哦

第一个后面要加 using namespace std
我学到目前为止没发现什么不同